function outer() {
	var num = 0;
	function inner() {
		num++;
		console.log(num);
	}
	return inner;
}
var operation = outer();
for (var i = 0; i < 3; i++) {
	operation();
}

const add = (() => {
	var counter = 0;
	return () => counter += 1;
})();
for (var i = 0; i < 3; i++) {
	console.log(add());
}

for (var i = 0; i < 3; i++) {
	setTimeout(function (num) {
		return function () {
			console.log(num);
		}
	}(i), 0);
}
